window.onload=function(){
    var oParent = document.getElementById("div1");
    var aInput = oParent.getElementsByTagName("input");
    var aDiv = oParent.getElementsByTagName("div");
    init();

    function init(){
        for(var i=0; i<aInput.length;i++){
            aInput[i].index = i;
            aInput[i].onclick=change;
        }
    }

    function change(){
        for(var i=0; i<aInput.length;i++){
            aInput[i].className="";
            aDiv[i].style.display="none";
        }
        this.className="active";
        aDiv[this.index].style.display="block";
    }
}


